home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 11
/
FM Towns Free Software Collection 11.iso
/
t_os
/
game
/
gt
/
gt.bas
< prev
next >
Wrap
BASIC Source File
|
1995-08-08
|
13KB
|
533 lines
10 '-----------------------------------------------------
20 ' GENERAL TARGET ver. 1.0
30 '
40 ' programed by T.Toshima
50 '-----------------------------------------------------
60 :
70 CLEAR ,,,FRE(4)*.7!
80 DEFINT A-Z
90 WIDTH 80,25
100 RANDOMIZE TIME/4
101 ON ERROR GOTO *ERROR
110 T_MAX=1
120 DIM SPRCHR_NO%(11),TARGET%(T_MAX,4),OLD_RND%(T_MAX)
130 DIM RANK$(49),RANK%(49)
140 SCREEN @1
150 COLOR 7,0
160 CLS
170 OUT &H440,17,2
180 OUT &H442,240,2
190 GOSUB *RANK_LOAD
200 GOSUB *SPR_PTN_SET
210 GOSUB *SPR_CHR_SET
220 GOSUB *MOUSE_SET
230 :
240 '----------------------------------------
250 *INIT
260 '----------------------------------------
270 :
280 SCREEN 0
290 SCREEN @1
300 COLOR 7,0,0,4
310 CLS
320 VIEW(0,0)-(255,255)
330 WINDOW(0,0)-(255,255)
340 SCORE=0
350 FLG=0
360 RESTORE *DATA
390 OUT &H440,17,2
400 OUT &H442,INT(480\2+0*256),2
410 :
420 GOSUB *OPENING
430 GOSUB *SCREEN_SET
440 GOSUB *REDRAW_SCORE
450 :
460 '-----------------------------------------
470 *MAIN
480 '-----------------------------------------
490 :
500 GOSUB *COUNT
510 GOSUB *MOUSE_PUT
520 WHILE FLG<=20
530 FOR LOOP1=0 TO 89
540 SPRITE TIME
550 GOSUB *MOUSE_CHECK
560 NEXT
570 BEEP 363523,30,1250
580 FOR LOOP1=0 TO 1
590 FOR LOOP2=0 TO 15
600 SPRITE TIME
610 GOSUB *MOUSE_CHECK
620 SPRITE TIME
630 GOSUB *TARGET_MOVE
640 NEXT
650 NEXT
660 FLG=FLG+1
670 WEND
680 GOSUB *QUIET
690 GOSUB *RANKING_CHECK
700 GOSUB *RANKING_VIEW
710 GOTO *INIT
720 :
730 '---------------------------------------
740 *QUIET
750 '---------------------------------------
760 :
770 FOR I=0 TO 89
780 GOSUB *MOUSE_CHECK
790 NEXT
800 FOR I=0 TO 11
810 SPRITE 0,SPRCHR_NO%(I),0
820 NEXT
830 SYMBOL(87,103),"それまで!",1,1,2,,,1
840 WHILE MOUSE(2,0)=0 : WEND
850 WHILE MOUSE(2,0) : WEND
860 FOR I=0 TO 239 STEP 2
870 LINE(0,I)-(255,I),PSET,0
880 LINE(0,239-I)-(255,239-I),PSET,0
890 WAIT 1
900 NEXT
901 SPRITE OFF
910 RETURN
920 :
930 '-----------------------------------------
940 *RANKING_CHECK
950 '-----------------------------------------
960 :
970 SPRITE OFF
980 CLS
990 OUT &H440,17,2
1000 OUT &H442,240,2
1010 RANK_IN=0
1020 RANK=0
1030 'GOSUB *RANK_LOAD
1040 FOR I=0 TO 49
1050 IF RANK%(I)<=SCORE THEN RANK=I+1 : RANK_IN=1 : I=49
1060 NEXT
1070 IF RANK_IN=0 THEN RETURN
1080 FOR I=49 TO RANK STEP -1
1090 RANK%(I)=RANK%(I-1)
1100 RANK$(I)=RANK$(I-1)
1110 NEXT
1120 X=27 : Y=79
1130 XX=227 : YY=149
1140 GOSUB *DRAW_WINDOW
1150 X=203 : Y=113
1160 XX=51 : YY=92
1170 GOSUB *DRAW_WINDOW
1180 X=203 : Y=133
1190 XX=51 : YY=122
1200 GOSUB *DRAW_WINDOW
1210 CONSOLE 0,24,2
1220 SYMBOL(127-13*8,31),"すばらしい!ぜひ、お名前を",1,1,6,,,1
1230 COLOR 4:LOCATE 21,10:PRINT "例:浦和市立 遠嶋"
1240 COLOR 6:LOCATE 37,11:PRINT "※8文字まで有効です。"
1250 COLOR 4:LOCATE 21,13:INPUT "",A$
1260 RANK%(RANK-1)=SCORE
1270 RANK$(RANK-1)=LEFT$(A$,16)
1280 A$="" : RANK_IN=0
1290 GOSUB *RANK_SAVE
1300 CLS
1310 SPRITE ON
1320 RETURN
1330 :
1340 '-----------------------------------------
1350 *DRAW_WINDOW
1360 '-----------------------------------------
1370 :
1380 LINE(X,Y)-(XX,YY),PSET,[17*8,17*8,17*8],BF
1390 CONNECT(X,YY)-(X,Y)-(XX,Y),[25*8,25*8,25*8]
1400 CONNECT(X,YY)-(XX,YY)-(XX,Y),[10*8,10*8,10*8]
1410 RETURN
1420 :
1430 '-----------------------------------------
1440 *RANKING_VIEW
1450 '-----------------------------------------
1460 :
1470 PY=0 : SP=2
1480 CLS
1481 SPRITE OFF
1490 MOUSE 0
1500 MOUSE 1,0,0
1510 'GOSUB *RANK_LOAD
1520 FOR I=50 TO (RANK-8)*-(RANK-8>=0)+1 STEP -1
1530 FOR R=0 TO 16/SP-1
1540 A=(PY+240) MOD 256
1550 LINE(16,A)-(255,A+SP-1),PSET,[0,0,0],BF
1560 SYMBOL(31-LEN(STR$(I))*8,A+R*SP),STR$(I),1,1,6,,,1
1570 SYMBOL(96-LEN(STR$(RANK%(I-1)))*8,A+R*SP),STR$(RANK%(I-1)),1,1,4
1580 SYMBOL(239-LEN(RANK$(I-1))*8,A+R*SP),RANK$(I-1),1,1,5
1590 PY=PY-SP
1600 IF PY<0 THEN PY=PY+256
1610 OUT &H440,17,2
1620 OUT &H442,240+PY*256,2
1630 WAIT 1
1640 IF MOUSE(2,0) AND DEMO=1 THEN
1650 BREAK_FLG=1
1660 R=16/SP-1
1670 I=(RANK-8)*-(RANK-8>=0)+1
1680 ENDIF
1690 NEXT
1700 NEXT
1710 IF BREAK_FLG=1 THEN
1720 BREAK_FLG=0
1730 PY=0 : SP=0 : A=0
1740 OUT &H440,17,2
1750 OUT &H442,240,2
1760 RETURN
1770 ENDIF
1780 IF RANK<>0 THEN
1790 FOR I=1 TO 5
1800 IF RANK<8 THEN
1810 A=(PY+(RANK-1)*16) MOD 256
1820 LINE(0,A)-(255,A+15),XOR,2,BF
1830 ELSE
1840 A=(PY+7*16) MOD 256
1850 LINE(0,A)-(255,A+15),XOR,2,BF
1860 ENDIF
1870 WAIT 50
1880 NEXT
1890 ENDIF
1900 FOR I=0 TO 299
1910 IF MOUSE(2,0) THEN I=299
1920 WAIT 1
1930 NEXT
1940 PY=0 : SP=0 : A=0
1950 OUT &H440,17,2
1960 OUT &H442,240,2
1970 RETURN
1980 :
1990 '-----------------------------------------
2000 *RANK_LOAD
2010 '-----------------------------------------
2020 :
2030 OPEN "I",1,"RANKING.DAT"
2040 FOR I=0 TO 49
2050 INPUT #1,RANK$(I),RANK%(I)
2060 NEXT
2070 CLOSE
2080 RETURN
2090 :
2100 '-----------------------------------------
2110 *RANK_SAVE
2120 '-----------------------------------------
2130 :
2140 KILL "RANKING.DAT"
2150 OPEN "O",1,"RANKING.DAT"
2160 FOR I=0 TO 49
2170 WRITE #1,RANK$(I),RANK%(I)
2180 NEXT
2190 CLOSE
2200 RETURN
2210 :
2220 '-----------------------------------------
2230 *OPENING
2240 '-----------------------------------------
2250 :
2260 DIM G%(61439)
2270 MOUSE 0
2280 MOUSE 1,0,0
2290 LOAD@"op.tif"
2300 GET@A(0,0)-(255,239),G%
2310 T$=TIME$
2320 WHILE MOUSE(2,0)=0
2330 IF T$<>TIME$ THEN A=A+1:T$=TIME$
2340 IF A=10 THEN
2350 A=0 : DEMO=1 : RANK=0
2360 GOSUB *RANKING_VIEW
2370 PUT@A(0,0)-(255,239),G%
2380 ENDIF
2390 WEND
2400 WHILE MOUSE(2,0) : WEND
2410 ERASE G% : DEMO=0
2420 RETURN
2430 :
2440 '-----------------------------------------
2450 *COUNT
2460 '-----------------------------------------
2470 :
2480 FOR I=3 TO 1 STEP -1
2490 LINE(104,101)-(151,138),PSET,[0,0,31*8],BF
2500 SYMBOL(112,103),AKCNV$(RIGHT$(STR$(I),1)),2,2,6,,,1
2510 BEEP 363523,35,400
2520 WAIT 50
2530 NEXT
2540 LINE(104,101)-(151,138),PSET,[0,0,31*8],BF
2550 SYMBOL(112,103),"始",2,2,2,,,1
2560 BEEP 363523,60,600
2570 WAIT 50
2580 LINE(104,101)-(151,138),PSET,[0,0,31*8],BF
2590 RETURN
2600 :
2610 '-----------------------------------------
2620 *TARGET_MOVE
2630 '-----------------------------------------
2640 :
2650 FOR I=0 TO T_MAX
2660 NO=TARGET%(I,0)
2670 MOV=TARGET%(I,1)
2680 MAX=TARGET%(I,2)
2690 VE=TARGET%(I,3)
2700 TYPE=TARGET%(I,4)
2710 A=(NO\3=0)*-41+(NO\3=1)*-97+(NO\3=2)*-109
2720 IF NO=0 OR NO=3 OR NO=6 THEN VX= (MAX/16):VY= 0 '右へ
2730 IF NO=1 OR NO=4 OR NO=7 THEN VX=-(MAX/16):VY= 0 '左へ
2740 IF NO=2 THEN VX= 0:VY=-(MAX/16) '上へ
2750 IF NO=5 THEN VX= 0:VY= (MAX/16) '下へ
2760 MOV=MOV+(MAX/16)*VE
2770 SPRITE 6,A,VX*VE,VY*VE
2780 IF MOV=MAX THEN VE=-VE
2790 IF MOV=0 THEN GOSUB *GET_INIT : GOSUB *TARGET_REMOVE
2800 TARGET%(I,0)=NO
2810 TARGET%(I,1)=MOV
2820 TARGET%(I,2)=MAX
2830 TARGET%(I,3)=VE
2840 TARGET%(I,4)=TYPE
2850 NEXT
2860 A=0
2870 RETURN
2880 :
2890 '-----------------------------------------
2900 *TARGET_REMOVE
2910 '-----------------------------------------
2920 :
2930 RESTORE *TARGET_XY
2940 A=(NO\3=0)*-41+(NO\3=1)*-97+(NO\3=2)*-109
2950 FOR L=0 TO NO
2960 READ X,Y
2970 NEXT
2980 SPRITE 6,A,X-SPRITE(A,6),Y-SPRITE(A,7)
2990 RETURN
3000 *TARGET_XY
3010 DATA 480,80 , 224,80 , 96,211 , 48,96
3020 DATA 176,96 , 112,10 , 88,109 , 152,109
3030 :
3040 '-----------------------------------------
3050 *SPR_PTN_SET
3060 '-----------------------------------------
3070 :
3080 DIM BUFFER%(255),SPR_PAT%(256*169-1)
3090 P=0 : S=0
3100 SYMBOL(127-13*8,111),"しばらくお待ちください・・",1,1,7,,,1
3110 LOAD@"spr_data.dat",SPR_PAT%
3120 DEF SPRITE 99,0
3130 FOR I=0 TO 168
3140 FOR J=0 TO 255
3150 BUFFER%(J)=SPR_PAT%(I*256+J)
3160 NEXT
3170 DEF SPRITE 0,4*I,BUFFER%,1
3180 'PUT@A(0,0)-(15,15),BUFFER%
3190 NEXT
3200 ERASE BUFFER%,SPR_PAT%
3210 CLS
3220 RETURN
3230 :
3240 '----------------------------------------
3250 *SPR_CHR_SET
3260 '----------------------------------------
3270 :
3280 RESTORE *DATA_OF_SPRITE
3290 I=0:P=0
3300 READ S,X,Y,XX,YY
3310 WHILE XX<>99
3320 DEF SPRITE 1,P,(X,Y),S*4,XX,YY,0
3330 SPRCHR_NO%(I)=P
3340 P=P+XX*YY
3350 I=I+1
3360 READ S,X,Y,XX,YY
3370 WEND
3380 P=0 : S=0
3390 X=0 : Y=0
3400 XX=0 : YY=0
3410 RETURN
3420 :
3430 *DATA_OF_SPRITE
3440 DATA 0,119,111,1,1 , 1,0,80,2,8 , 1,224,80,2,8 , 17,96,211,4,2
3450 DATA 25,480,80,4,8 , 121,48,96,2,4 , 121,176,96,2,4 , 129,112,10,2,4
3460 DATA 137,48,96,2,4 , 161,88,109,1,2 , 161,152,109,1,2 , 163,88,109,1,2
3470 DATA 1,1,1,99,99
3480 :
3490 '-----------------------------------------
3500 *MOUSE_SET
3510 '-----------------------------------------
3520 :
3530 MOUSE 0
3540 MOUSE 4,0,2,255,239
3550 RETURN
3560 :
3570 '-----------------------------------------
3580 *MOUSE_PUT
3590 '-----------------------------------------
3600 :
3610 MOUSE 1,127,119,0
3620 SPRITE 0,0,0
3630 SPRITE 0,SPRCHR_NO%(0),1
3640 RETURN
3650 :
3660 '-----------------------------------------
3670 *MOUSE_CHECK
3680 '-----------------------------------------
3690 :
3700 SPRITE 6,0,MOUSE(0)-SPRITE(0,6)-6,MOUSE(1)-SPRITE(0,7)-6
3710 TRIG=MOUSE(2,0)
3720 IF OLD_TRIG=0 AND TRIG THEN GOSUB *SHOTTO
3730 OLD_TRIG=TRIG
3740 RETURN
3750 :
3760 '-----------------------------------------
3770 *SHOTTO
3780 '-----------------------------------------
3790 :
3800 DIM HANTEI%(T_MAX)
3810 OLD_NO=0
3820 RESTORE *TARGET_XY
3830 MX=MOUSE(4,0) : MY=MOUSE(5,0)
3840 FOR I=0 TO T_MAX
3850 RESTORE *TARGET_XY
3860 NO=TARGET%(I,0)
3870 MOV=TARGET%(I,1)
3880 MAX=TARGET%(I,2)
3890 FOR II=0 TO NO
3900 READ X,Y
3910 NEXT
3920 ON NO+1 GOSUB *RIGHT,*LEFT,*DOWN,*RIGHT,*LEFT,*UP,*RIGHT,*LEFT
3930 IF MX>=X AND MY>=Y AND MX<=XX AND MY<=YY AND TARGET%(I,4)<>2 THEN
3940 HANTEI%(I)=-1
3950 ENDIF
3960 NEXT
3970 IF SEARCH(HANTEI%,-1)=-1 THEN ERASE HANTEI%:RETURN
3980 FOR I=0 TO T_MAX
3990 NO=TARGET%(I,0)
4000 IF HANTEI%(I)=-1 AND OLD_NO<=NO THEN
4010 OLD_NO=NO
4020 MAX=TARGET%(I,2)
4030 T=I
4040 ENDIF
4050 NEXT
4060 IF TARGET%(T,4)=0 THEN
4070 BEEP 363523,15,1023
4080 SCORE=SCORE+100*(OLD_NO\3+1)
4090 ELSE
4100 BEEP 363523,15,124
4110 SCORE=SCORE-100*(OLD_NO\3+1)
4120 ENDIF
4130 GOSUB *REDRAW_SCORE
4140 TARGET%(T,4)=2
4150 A=(MAX/16)^2*4
4160 B=(OLD_NO\3=0)*-41+(OLD_NO\3=1)*-97+(OLD_NO\3=2)*-109
4170 IF B=41 THEN SPRITE 1,B,(25+A)*4
4180 IF B=97 THEN SPRITE 1,B,(137+A)*4
4190 IF B=109 THEN SPRITE 1,B,(163+A)*4
4200 T=0 : A=0 : B=0 : ERASE HANTEI%
4210 RETURN
4220 :
4230 '--------------------
4240 *RIGHT
4250 '--------------------
4260 :
4270 XX=(X+MAX+MOV-1) MOD 511
4280 YY=Y+MAX*2-1
4290 X=(X+MAX) MOD 511
4300 Y=Y
4310 RETURN
4320 :
4330 '--------------------
4340 *LEFT
4350 '--------------------
4360 :
4370 XX=X-1
4380 YY=Y+MAX*2-1
4390 X=X-MOV
4400 Y=Y
4410 RETURN
4420 :
4430 '--------------------
4440 *DOWN
4450 '--------------------
4460 :
4470 XX=X+MAX-1
4480 YY=Y-1
4490 X=X
4500 Y=Y-MOV
4510 RETURN
4520 :
4530 '--------------------
4540 *UP
4550 '--------------------
4560 :
4570 XX=X+MAX-1
4580 YY=Y+MAX*2+MOV-1
4590 X=X
4600 Y=Y+MAX*2
4610 RETURN
4620 :
4630 '-----------------------------------------
4640 *REDRAW_SCORE
4650 '-----------------------------------------
4660 :
4670 A=-20*(SCORE>=0)+-14*(SCORE<0)
4680 LINE(176,16)-(239,31),PSET,[A*8,A*8,A*8],BF
4690 SYMBOL(239-LEN(STR$(SCORE))*8,16),STR$(SCORE),1,1,1,,,1
4700 RETURN
4710 :
4720 '-----------------------------------------
4730 *SCREEN_SET
4740 '-----------------------------------------
4750 :
4751 SPRITE ON
4752 SPRITE SCREEN (32,0)
4753 OUT &H440,17,2
4754 OUT &H442,INT(480\2+0*256),2
4760 LOAD@"base.tif",(0,0)
4770 FOR I=1 TO 11
4780 SPRITE 0,SPRCHR_NO%(I),1
4790 NEXT
4800 FOR I=0 TO T_MAX
4810 GOSUB *GET_INIT
4820 GOSUB *TARGET_REMOVE
4830 TARGET%(I,0)=NO
4840 TARGET%(I,1)=0
4850 TARGET%(I,2)=MAX
4860 TARGET%(I,3)=VE
4870 TARGET%(I,4)=TYPE
4880 NEXT
4890 B=0
4900 RETURN
4910 :
4920 '-----------------------------------------
4930 *GET_INIT
4940 '-----------------------------------------
4950 :
4960 RESTORE *DATA
4970 A=INT(RND(1)*3)
4980 WHILE SEARCH(OLD_RND%,A+1)<>-1
4990 A=INT(RND(1)*3)
5000 WEND
5010 NO=3 * A + INT(RND(1)*(3+(A=2)))
5020 VE=1
5030 TYPE=INT(RND(1)*2)
5040 FOR L=0 TO NO
5050 READ MAX
5060 NEXT
5070 IF T_MAX<>0 THEN
5080 FOR L=T_MAX TO 1 STEP -1
5090 OLD_RND%(L)=OLD_RND%(L-1)
5100 NEXT
5110 ENDIF
5120 OLD_RND%(0)=A+1
5130 A=(NO\3=0)*-41+(NO\3=1)*-97+(NO\3=2)*-109
5140 IF A=41 THEN SPRITE 1,A,(25+32*TYPE)*4
5150 IF A=97 THEN SPRITE 1,A,(137+8*TYPE)*4
5160 IF A=109 THEN SPRITE 1,A,(163+2*TYPE)*4
5170 A=0 : L=0
5180 RETURN
5190 *DATA
5200 DATA 64,64,64,32,32,32,16,16
5210 :
5211 '-----------------------------------------
5212 *ERROR
5213 '-----------------------------------------
5214 :
5215 RESUME NEXT
5216 :